package com.loy.service;

import com.loy.entity.TestProto;
import com.loy.entity.TestServiceGrpc;
import io.grpc.stub.StreamObserver;

public class TestServiceImpl  extends TestServiceGrpc.TestServiceImplBase {

    @Override
    public void testSuns(TestProto.TestRequest request, StreamObserver<TestProto.TestResponse> responseObserver) {
        String name = request.getName();
        System.out.println(name);

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        responseObserver.onNext(TestProto.TestResponse.newBuilder().setResult("test is ok").build());
        responseObserver.onCompleted();
    }
}
